package com.zzh.order;


import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
@EnableDiscoveryClient
public class OrderApplication {
    public static void main(String[] args) {
        SpringApplication.run(OrderApplication.class);
    }


    //以rest方式调用，默认开始负载均衡功能，如果以别名进行服务调用必须加上LoadBalanced
    @Bean(name="remoteRestTemplate")
/*    @LoadBalanced*/
    RestTemplate restTemplate() {
        return new RestTemplate();
    }
}
